require("gip")
require("pakfile")

local dstDir = "e:\\tmp\\bug\\"
local pakName = "e:\\tmp\\b2"

local pak = pakfile.open( pakName, "rm")
if pak == nil then
    print( "open " .. pakName .. " failed")
end

local function callback( filename, content)
    local path = dstDir .. filename
    gip.createParentDir( path)
    local file = io.open( path, "wb")
    if file == nil then
        print( "create file " .. path .. " failed")
        return
    end
    
    print( #content)
    file:write( content)
    file:close()
end

pak.trans( callback)
pak.close()